from django.template.library import Library
from operate.models import Collect
register = Library()


@register.filter
def has_collected(article, user):
    if user.is_authenticated and Collect.objects.filter(article=article, user=user).exists():
        return True
    return False